/** @file MapView.js
@brief The MapView object functions

MapView.js is the functions file directly connected to the MapView object.
It includes all the funcions used to manage the navigation map.

@author © 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
@author Distributed under the LGPL 3.0 license.
@date July, 2011

@licensenote
*/

/*
  swapMapView()
  The function inverts the current map view from street to satellite.
  The different map view modes are changed in circular mode depending on
  mapViewModes variable value.
  */
function swapMapView() {
    mapViewModes++;

    if (mapViewModes == 4) { mapViewModes = 1; }

    switch (mapViewModes) {
    case 1:
        map.mapType = Map.StreetMap;
        break;
    case 2:
        map.mapType = Map.SatelliteMapDay;
        break;
    case 3:
        map.mapType = Map.TerrainMap;
        break;
    case 4:
        map.mapType = Map.SatelliteMapNight;
        break;
    }
}

/*
    swapZoom()
    The function inverts the current zoom level
    (from max to min and vice-versa).
    Note that the function don't check the current
    zoom level when it is applied and the zoom is
    only reversed it the value is already at the max.
    This fucntion should be used for one-touch zoom maximization
    and the control is useful only if the user tap moer than once the
    zooming function. The result is:

    Tap once: max zoom
    Tap two: min zoom.
  */
function swapZoom() {
    if (map.zoomLevel == maxZoom) {
        map.zoomLevel = minZoom;
        return minZoom;
    }
    else {
        map.zoomLevel = maxZoom;
        return maxZoom;
    }
}
